// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 分页查询 GET /api/users/ */
export async function selectUserInfos(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.selectUserInfosParams,
  options?: { [key: string]: any },
) {
  return request<API.ResponsePagerUserInfoEntity>('/api/users/', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 新增用户 POST /api/users/ */
export async function insertUserInfo(
  body: API.UserInfoEntity,
  options?: { [key: string]: any },
) {
  return request<API.ResultBodyUserInfoEntity>('/api/users/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 当前会话用户 GET /api/users/current */
export async function currentUser(options?: { [key: string]: any }) {
  return request<API.ResultBodySessionUser>('/api/users/current', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 登录 POST /api/users/login */
export async function login(
  body: API.UserInfoDTO,
  options?: { [key: string]: any },
) {
  return request<API.ResultBodySessionUser>('/api/users/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 退出登录 DELETE /api/users/logout */
export async function logout(options?: { [key: string]: any }) {
  return request<API.ResultBodyobject>('/api/users/logout', {
    method: 'DELETE',
    ...(options || {}),
  });
}

/** 查找指定账号 GET /api/users/${param0} */
export async function selectUserInfo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.selectUserInfoParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.ResultBodyUserInfoEntity>(`/api/users/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 更新用户 PUT /api/users/${param0} */
export async function updateUserInfo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateUserInfoParams,
  body: API.UserInfoEntity,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.ResultBodyUserInfoEntity>(`/api/users/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: { ...queryParams },
    data: body,
    ...(options || {}),
  });
}

/** 删除用户 DELETE /api/users/${param0} */
export async function removeUserInfo(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.removeUserInfoParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.ResultBodystring>(`/api/users/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  });
}
